<?php 
import('@.Model.CommonModel');
class MemberModel extends Model
{//类定义开始
	protected $_validate	 =	 array(
		array('username','require','用户名必须！'),
        array('username','','用户名已经存在',0,'unique','add'), 
		array('password','require','用户密码必须！'),
		array('password2','password','密码不一致！',0,'confirm'),
		array('email','email','Email格式不对！'),
        array('verify','require','验证码必须！'), 
        array('verify','CheckVerify','验证码错误',0,'callback'), 
		);

	protected $_auto	 =	 array(
		array('status','1','ADD'),
		array('regtime','time','ADD','function'),
		);

	//设定状态
	function setStatus($ids,$status='1') {
		$result = $this->setField('status',$status,"uid in ($ids)");
		if(false===$result){
			return false;
		}else{
			return true;
		}
	}

	//审核
	function check($ids,$status='1') {
		$result = $this->setField('ischeck',$status,"uid in ($ids)");
		if(false===$result){
			return false;
		}else{
			return true;
		}
	}

	public function CheckVerify() {
		return md5($_POST['verify']) == $_SESSION['verify'];
	}
}//类定义结束
?>